<!DOCTYPE html>
<html>
<head>
  <title>ChemistPro</title>
  <%= stylesheet_link_tag    "application", :media => "all" %>
  <%= javascript_include_tag "application" %>
  <% if @formula %>
  <script type="text/x-mathjax-config">
    MathJax.Hub.Config({tex2jax: {inlineMath: [['$','$']]}});
  </script>
  <%= mathjax_tag %>
  <% end %>
  <script type="text/javascript">
    aliasTable = {};
    cjs_getElement = function(id) {
      var name = aliasTable[id];
      if (name == undefined)
        return $('#' + id);//document.getElementById(id);
      else
        return cjs_getElement(name);
    }
    cjs_show = function(id) {
      cjs_getElement(id)[0].style.display=""
    }
    cjs_hide = function(id) {
      cjs_getElement(id)[0].style.display="none"
    }
    cjs_submit = function(id) {
      cjs_getElement(id).submit();
    }
    function cjs_set(element, value) {
      return function(id) {
        cjs_getElement(id)[0].elements[element].value = value;
      }
    }
    cjs_switch = function(id) {
      var e = cjs_getElement(id)[0].style;
      if (e.display == "")
        e.display = "none"
      else
        e.display = ""
    }
    //cjs_replace & cjs_append only used in ajax
    cjs_replace = function(id, value) {
      cjs_getElement(id).replaceWith(value);
    }
    cjs_append = function(id, value) {
      cjs_getElement(id).append(value);
    }
    open_edit = function(div_prefix, id) {
      document.getElementById(div_prefix + "_show_" + id).style.display="none";
      document.getElementById(div_prefix + "_edit_" + id).style.display="";
    }
    close_edit = function(div_prefix, id) {
      document.getElementById(div_prefix + "_show_" + id).style.display="";
      document.getElementById(div_prefix + "_edit_" + id).style.display="none";
    }
    set_question_type_selection = function(question_id, new_type_id, form_id) {
      document.getElementById("question_type_id_" + question_id).value = new_type_id;
      document.getElementById("question_type_changed_" + question_id).value = 1;
      $('#'+form_id).submit();
    }
    close_new_question = function() {
      document.getElementById("question_new").remove();
      document.getElementById("append_question").style.display="";
    }

    remark_set_reply_position_submit = function(topic_id, remark_id) {
      document.getElementById("remark_parent_remark_id_" + topic_id).value=remark_id;
      document.getElementById("remark_operation_on_topic_" + topic_id).value='reply';
      $('#' + "topic_append_remark_form_" + topic_id).submit();
    }
    remark_set_remark_type_question_submit = function(remark_id) {
      
    }
  </script>
  <%= csrf_meta_tags %>
</head>
<body>

<div id="main">
<%= render 'layouts/top' %>
<div id="content" style="min-height:450px;">
<%= yield %>
</div>
<%= render 'layouts/bottom' %>
</div>

</body>
</html>
